[Data]
life = 1000
attack = 100
defence = 100
fall.defence_up = 50
liedown.time = 20
airjuggle = 25
sparkno = S6001
guard.sparkno = -1
KO.echo = 0
volume = 0
IntPersistIndex = 0
FloatPersistIndex = 0

[Size]
xscale = 1
yscale = 1
ground.back = 12
ground.front = 12
air.back = 10
air.front = 10
height = 40
attack.dist = 80
proj.attack.dist = 80
proj.doscale = 2
head.pos = 5, -65
mid.pos = 5, -45
shadowoffset = 0
draw.offset = 0,0

[Velocity]
walk.fwd  = 2
walk.back = -1.8
run.fwd  = 5,-2.8
run.back = -4.6,-2.8
jump.neu = 0,-6.8
jump.back = -2
jump.fwd = 2.3
runjump.back = -1.6,-3.1
runjump.fwd = 1.8,-3.1
airjump.neu = 0
airjump.back = 0
airjump.fwd = 0

[Movement]
airjump.num = 0
airjump.height = 0
yaccel = .44
stand.friction = .85
crouch.friction = .82

[Quotes]
victory1 = "..."
victory2 = "...?"
victory3 = "Hmph..."
victory4 = "...Heh."
victory5 = "!!! !!! !!!"
victory6 = "...sigh."
victory7 = "...?!?"
;---------------------------------------------------------------------------
;Var List

;***Universal***
;var(0) = Command variable
;var(1) = Famicom Fighters character detection
;var(2) = First hit counter
;var(3) = Helper select
;var(4) = Victory quote variable
;var(5) = Juggle Count
;var(6) = Helper health
;var(7) = Helper meter
;var(8) = Pause variable
;var(9) = Special move combo condition
;var(10) = Command Detection
;var(20) = Detection for first hit of multi-hit/multi-state moves
;var(21) = Test Var
;var(22) = Identification Variable
;var(23) = Counter for Training Mode Detection
;var(24) = Training Mode Var	  
;var(25) = Death State Check
;var(27) = Test Var
;var(28) = Super Finish
;var(30) = Hide helper bars and move names
;var(31) = Max helper health
;var(32) = Countdown for helper select
;var(33) = Back Charge
;var(34) = Back Charge Ready
;var(35) = Down Charge
;var(36) = Down Charge Ready
;var(37) = Projectile Ready
;var(38) = Helper Ready
;var(39) = Helper Projectile Ready
;var(40) = Air Guard Option
;var(41) = Air Recovery Option
;var(42) = Helpers Option
;var(43) = Pause Option 
;var(44) = Control Scheme
;var(45) = Standalone Helper Bar (X-Position)
;var(46) = Standalone Helper Bar (Y-Position)
;var(47) = Standalone Helper Bar (BG)
;var(48) = Alt Victory Music
;var(50) = Reaction var
;var(51) = Tag team var
;var(52) = Projectile animation var
;var(53) = Assist check
;var(54) = Hyper Tag-In check
;var(55) = AI switch check
;var(58) = Special move command time var
;var(59) = AI Var
;fvar(0) = Helper bars scaling
;fvar(20) = Damage scaling, current power
;fvar(21) = Damage scaling, future power
;fvar(24) = Test Var
;fvar(30) = Special projectile Vel X
;fvar(31) = Special projectile Vel Y
;fvar(32) = Super projectile Vel X
;fvar(33) = Super projectile Vel Y
;fvar(34) = Helper projectile Vel X
;fvar(35) = Helper projectile Vel Y
;fvar(36) = Helper Vel X
;fvar(37) = Helper Vel Y


;***Specific***
;var(11) = Prevstateno variable for Suplex; also used for detecting when EX Shooting Slam has been used
;var(12) = Nova Whip detection for combos
;var(13) = Prevstateno variable for Nova Whip
;var(14) = Did Star Man slap this opponent silly (Unused)
;var(15) = Super Armor hits
;var(16) = Super Armor timer
;var(17) = Prevstateno variable for EX Nova Whip
;fvar(10) = Air X-acceleration during air moves
;fvar(11) = Air Y-acceleration during air moves

;***Helpers***
;(Almost?) Universal
;-fvar(1) = Pos X coordinates
;-fvar(2) = Pos Y coordinates
;Reflector
;-var(2) = Damage from projectile
;-var(3) = Projectile speed
;---------------------------------------------------------------------------
; Lose by Time Over
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

[State 170, 1]
type = PlaySnd
trigger1 = !Time
value = S11,1

[State 170, 2]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

;---------------------------------------------------------------------------
; Win state decider
[Statedef 180]
type = S

[State 180, 1]
type = ChangeState
trigger1 = !MatchOver && !Time
value = 181+8*Cond(NumEnemy,enemy,Name = "Bonus" && enemy,Var(0) = 0 && enemy,Var(5) = 0,0)

[State 180, 2]
type = ChangeState
trigger1 = (MatchOver && !Time && Cond(NumEnemy,enemynear(0),Pos Y != 0 || (enemynear(0),Anim = [5600,5699]) || enemynear(0),Anim = 5150,0)) || TeamMode = Simul
value = 186+3*Cond(NumEnemy,enemy,Name = "Bonus" && enemy,Var(0) = 0 && enemy,Var(5) = 0,0)

[State 180, 2]
type = ChangeState
trigger1 = MatchOver && !Time && Cond(NumEnemy,enemynear(0),Pos Y = 0 && (enemynear(0),Anim != [5600,5699]) && enemynear(0),Anim != 5150,0) && TeamMode != Simul
value = 182+7*Cond(NumEnemy,enemy,Name = "Bonus" && enemy,Var(0) = 0 && enemy,Var(5) = 0,0)

;---------------------------------------------------------------------------
;Round Win
[Statedef 181]
type = S
ctrl = 0
anim = 180
velset = 0,0

[State 181, 1]
type = PlaySnd
trigger1 = AnimElem = 4
value = F0,1
;---------------------------------------------------------------------------
;Match Win
[Statedef 182]
type = S
ctrl = 0
anim = 20
velset = 0,0

[State 181, 1]
type = AssertSpecial
trigger1 = Anim != 183 || AnimElemTime(3) < (200 - 80*(PalNo = 5) + 180*(PalNo = 6))
flag = roundnotover

[State 181, 2]
type = ScreenBound
trigger1 = 1 
value = 0

[State 181, 3]
type = VelSet
trigger1 = !Time
x = 2*const(size.xscale)

[State 181, 4]
type = Null
trigger1 = !Time && (enemynear(0),Pos X < Pos X)

[State 181, 5]
type = VelSet
trigger1 = abs(Pos X - enemynear(0), Pos X) = [0, 10]
x = 0

[State 181, 6]
type = ChangeAnim
trigger1 = Anim = 20 && abs(Pos X - enemynear(0), Pos X) = [0, 10]
value = 181

[State 181, 7]
type = PosSet
trigger1 = Anim = 181 && AnimElem = 1
x = enemynear(0), Pos X
y = -16*const(size.yscale)
persistent = 0

[State 181, 8]
type = VelAdd
trigger1 = Anim = 181
y = .2*const(size.yscale)

[State 181, 9]
type = ChangeAnim
trigger1 = Anim = 181 && Pos Y >= 0
value = 182

[State 181, 10]
type = PosSet
trigger1 = Anim = 182
y = 0

[State 181, 11]
type = VelSet
trigger1 = Anim = 182
y = 0

[State 181, 12]
type = Helper
trigger1 = Anim = 182 && AnimElem = 1
name = "Referee"
ID = 180
stateno = 184
pos = 0,0
postype = back
facing = 1
ownpal = 1

[State 181, 14]
type = ChangeAnim
triggerall = Anim = 182 && NumHelper(180)
trigger1 = helper(180),StateNo = 185 && helper(180),Time = 304
value = 183

[State 0, SprPriority]
type = SprPriority
trigger1 = Anim = 183
value = -4

[State 0, PosSet]
type = PosAdd
trigger1 = Anim = 183 && AnimElemTime(1) = 0
x = 10*const(size.xscale)

;---------------------------------------------------------------------------
;Match Win
[Statedef 184]
type = S
ctrl = 0
anim = 184
velset = 3.2*const(size.xscale),0
sprpriority = 5

[State 184, 1]
type = ChangeState
trigger1 = ParentDist X <= 0
value = 185
;---------------------------------------------------------------------------
;Match Win
[Statedef 185]
type = S
ctrl = 0
anim = 185
velset = 0,0
sprpriority = 5

[State 185, 1]
type = PosSet
trigger1 = !Time
x = root,Pos X 

[State 185, 2]
type = AssertSpecial
trigger1 = !NumPartner || Cond(NumPartner, partner,AuthorName != "KingPepe", 0)
trigger2 = Cond(NumPartner,partner,AuthorName = "KingPepe",0)
flag = nomusic

[State 185, 3]
type = PlaySnd
trigger1 = AnimElem = 3 || AnimElem = 5 || AnimElem = 7
value = S184,0+(1*(AnimElem = 5))+(2*(AnimElem = 7))

[State 185, 4]
type = PlaySnd
trigger1 = Time = 210
value = S11,1

[State 185, 5]
type = PlaySnd
triggerall = !NumPartner || Cond(NumPartner, partner,AuthorName != "KingPepe", 0)
trigger1 = Time = 304
value = S181,Cond(PalNo < 5,0,PalNo-1)

;---------------------------------------------------------------------------
;Match Win
[Statedef 186]
type = S
ctrl = 0
anim = 186
velset = 0,0

[State 181, 1]
type = AssertSpecial
trigger1 = Time < (230 - 80*(PalNo = 5) + 180*(PalNo = 6))
flag = roundnotover

[State 181, 1]
type = AssertSpecial
trigger1 = !NumPartner
flag = nomusic

[State 181, 2]
type = ScreenBound
trigger1 = 1 
value = 0

[State 181, 3]
type = VelSet
trigger1 = AnimElem = 7
y = -28*const(size.xscale)

[State 181, 4]
type = PlaySnd
triggerall = !NumPartner
trigger1 = !Time
value = S180,0

[State 181, 4]
type = PlaySnd
trigger1 = (ID = 56 || ID = 58) && Time = 0
trigger2 = (ID = 57 || ID = 59) && Cond(NumPartner,partner,Alive = 0,0) && !Time
value = S181,Cond(PalNo < 4,0,PalNo-1)

[State 181, 5]
type = PlaySnd
trigger1 = AnimElem = 7
value = S3050,0
;---------------------------------------------------------------------------
; Introduction
[Statedef 191]
type = S
ctrl = 0
anim = 190
velset = 0,0
sprpriority = 5

[State 191, 1]
type = AssertSpecial
trigger1 = 1
flag = Intro

[State 191, 1]
type = AssertSpecial
trigger1 = Time < 81
flag = Invisible 

[State 191, 2]
type = Null
trigger1 = 1
value = 0

[State 191, 3]
type = Explod
trigger1 = Time = 1
anim = 190
ID = 190
pos = ceil(-180*const(size.xscale)),ceil(-90*const(size.yscale))
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = 3.5*const(size.xscale),-4.7*const(size.yscale)
accel = 0,.44*const(size.yscale)
removetime = 35
pausemovetime = 0
scale = const(size.xscale),const(size.yscale)
sprpriority = 2
ontop = 0
shadow = -1
ownpal = 0
removeongethit = 0

[State 191, 3]
type = Explod
trigger1 = Time = 36
anim = 191
ID = 190
pos = ceil(-58*const(size.xscale)),0
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = 0,0
accel = 0,0
removetime = -2
pausemovetime = 0
scale = const(size.xscale),const(size.yscale)
sprpriority = 2
ontop = 0
shadow = -1
ownpal = 0
removeongethit = 0

[State 191, 3]
type = Explod
trigger1 = Time = 51
anim = 192
ID = 190
pos = ceil(-16*const(size.xscale)),0
postype = p1
facing = 1
vfacing = 1
bindtime = 1
vel = .5*const(size.xscale), -6.3*const(size.yscale)
accel = 0,.44*const(size.yscale)
removetime = 30
pausemovetime = 0
scale = const(size.xscale),const(size.yscale)
sprpriority = 2
ontop = 0
shadow = -1
ownpal = 0
removeongethit = 0

[State 191, 3]
type = Null
trigger1 = !Time
x = -250*(Facing)
y = -90

[State 191, 4]
type = Null
trigger1 = !Time
x = 3.5
y = -4.7

[State 191, 5]
type = Null
trigger1 = Pos Y < 0
y = .44

[State 191, 6]
type = Null
trigger1 = Pos Y >= 0
x = 0
y = 0

[State 191, 7]
type = Null
trigger1 = Pos Y >= 0
y = 0

[State 191, 8]
type = ChangeAnim
trigger1 = Anim = 190 && Pos Y >= 0
value = 191

[State 191, 9]
type = Null
trigger1 = Anim = 191 && (AnimElem = 2 || AnimElem = 3 || AnimElem = 4)
x = 14-6*(AnimElem = 3)+4*(AnimElem = 4)

[State 191, 10]
type = Null
trigger1 = Anim = 191 && AnimElem = 4
x = .8
y = -6.3

[State 191, 11]
type = ChangeAnim
trigger1 = Time = 51
value = 192

[State 191, 11]
type = ChangeAnim
trigger1 = Time = 81
value = 193

[State 191, 12]
type = Null
trigger1 = Anim = 192 && AnimElem = 1
x = -70*(Facing)

[State 191, 13]
type = PlaySnd
trigger1 = !Time
value = S40,0

[State 191, 14]
type = PlaySnd
trigger1 = Anim = 192 && AnimElem = 1
value = S190,0

[State 191, 15]
type = ChangeState
trigger1 = Anim = 193 && !AnimTime
value = 0

;---------------------------------------------------------------------------
; Taunt
[Statedef 195]
type = S
movetype = I
physics = S
ctrl = 0
anim = 195
velset = 0,0
sprpriority = 2

[State 195, 1]
type = PlaySnd
trigger1 = AnimElem = 3 || AnimElem = 6
value = S184,0

[State 195, 2]
type = ChangeState
trigger1 = !AnimTime
value = 0
ctrl = 1
;========================<EXPLODSIVE BUFFERING HELPER>=============================
[StateDef 90000005]
type = A
physics = N
moveType = I
anim = 1
velSet = 0,0
ctrl = 0
     
[State 90000005, DisplayToClipboard]
type = DisplayToClipboard
trigger1 = 1
text = "by JustMorphPointman"
ignoreHitPause = 1
;---------------------------------------------------------------------------
; Override common states (use same number to override) :
;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1

[State 40]
Type= ChangeState
Triggerall= !Time
Triggerall= var(59)
trigger1 = (enemy,fvar(30) = 0) || (enemy,fvar(32) = 0)  || (enemy,fvar(34) = 0) 
trigger1 = (enemy,fvar(31) = -999) || (enemy,fvar(33)  = -999) || (enemy,fvar(35) = -999)
trigger1 = (P2MoveType != H) && !(enemynear(0),Pos Y >= -50)
trigger1 = random<var(50)*0.7
value=0
ctrl=1

[State 40, 1]
type = VarSet
trigger1 = !Time
sysvar(1) = 0

[State 40, 2]
type = VarSet
trigger1 = command = "holdfwd"
trigger1 = !var(59)
trigger2 = var(59)
trigger2 = (P2MoveType = H) && enemynear(0),Pos Y < -50
sysvar(1) = 1

[State 40, 3]
type = VarSet
trigger1 = command = "holdback"
trigger1 = !var(59)
trigger2 = var(59)
trigger2 = random>var(50)*0.01
trigger2 = (P2MoveType != H) && !(enemynear(0),Pos Y >= -50)
trigger2 = (enemy,fvar(30) = 0) || (enemy,fvar(32) = 0)  || (enemy,fvar(34) = 0) 
trigger2 = (enemy,fvar(31) = -999) || (enemy,fvar(33)  = -999) || (enemy,fvar(35) = -999)
sysvar(1) = -1

[State 40, 4]
type = VelSet
trigger1 = !AnimTime
x = Cond(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))*const(size.xscale)
y = const(velocity.jump.y)*const(size.yscale)

[State 40, 5]
type = VelSet
trigger1 = !AnimTime
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 6]
type = NotHitBy
trigger1 = 1
value = ,AT
time = 1

[State 40, 7]
type = ChangeState
trigger1 = !AnimTime
value = 50
ctrl = 1
;---------------------------------------------------------------------------
; Stand get-hit (shaking)
[Statedef 25000]
type    = S
movetype= H
physics = N
velset = 0,0

[State 25000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000,5010) + GetHitVar(animtype)

[State 25000, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 25000, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 25000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 25000, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 25000, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 25000, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 25000, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

[State -2, PosSet]
type = PosSet
trigger1 = !Time
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
y = 0

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

[State 5000, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030
;---------------------------------------------------------------------------
; HIT_TRIP (shaking)
[Statedef 25070]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5070, 1]
type = ChangeAnim 
trigger1 = 1
value = 5070

[State 5070, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 5071

[State 5070, 3]
type = ForceFeedback
trigger1 = time = 0
time = 12
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 25110]
type    = L
movetype= H
physics = N

[State 25110, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 25110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 25110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

[State 25110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)

[State 25110, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 25110, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5110, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5110, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5110, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5110 + (anim % 10))
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5110 + (anim % 10)

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 5110, 11] ;If just died
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 5110, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5110, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 5110, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine